import { MessageUser } from '@renderer/types'
import { defineStore } from 'pinia'

interface messageUserStoreInterface {
  messageUserList: MessageUser[]
}

export const useMessageUserList = defineStore('messageUser', {
  state: (): messageUserStoreInterface => {
    return {
      messageUserList: []
    }
  },
  getters: {
    getUserList: (state) => state.messageUserList
  },
  actions: {
    setUserList(list: MessageUser[]) {
      this.messageUserList = list
    },
    setUserListItem(value: MessageUser) {
      this.messageUserList.unshift(value)
    }
  }
})
